<template>
  <el-container class="layout-container-demo" style="height: 100%; width: 100%">
    <el-aside :width="asideWidth" height="100%">
      <el-scrollbar>
        <LeftMenu />
      </el-scrollbar>
    </el-aside>
    <el-container>
      <el-header>
        <TopHeader></TopHeader>
      </el-header>
      <el-main>
        <el-scrollbar>
          <RouterView></RouterView>
        </el-scrollbar>
      </el-main>
    </el-container>
  </el-container>
</template>

<script lang="ts" setup>
import { ref, onMounted } from "vue";
import { RouterView } from "vue-router";
import LeftMenu from "../../components/LeftMenu.vue";
import TopHeader from "../../components/TopHeader.vue";
import bus from "../../untils/bus";

// eslint-disable-next-line @typescript-eslint/no-explicit-any
const asideWidth: any = ref("200px");
onMounted(() => {
  bus.on("isCollapse", (val) => {
    if (val) {
      asideWidth.value = "64px";
    } else {
      asideWidth.value = "200px";
    }
    console.log("val", val,typeof val);
  });
});
</script>

<style scoped>
.layout-container-demo .el-header {
  position: relative;
  background-color: var(--el-color-primary-light-7);
  color: var(--el-text-color-primary);
}
.layout-container-demo .el-aside {
  color: var(--el-text-color-primary);
  background: var(--el-color-primary-light-8);
  /* transition: width 0.2s; */
}
.layout-container-demo .el-menu {
  border-right: none;
}
.layout-container-demo .el-main {
  padding: 0;
}
</style>
